<template>
  <view class="container">
    <!-- 员工列表 -->
    <view class="employee-list">
      <view class="employee-item" v-for="(employee, index) in employeeList" :key="index">
        <view class="item-left">
          <text class="account">{{ employee.account }}</text>
          <text class="role" v-if="employee.type==1">管理员</text>
		  <text class="role" v-else>员工</text>
        </view>
        <text class="time">添加时间：{{ employee.updateTime }}</text>
      </view>
    </view>
    
    <!-- 新增员工按钮 -->
    <view class="add-btn" @click="addEmployee" v-if="userInfo.type==1">
      <text>新增员工</text>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      employeeList: [
       
      ],
	  userInfo:'',
    }
  },
  onLoad() {
	 this.userInfo= uni.getStorageSync("userInfo")
  },
  onShow() {
  	this.getList()
  },
  methods: {
	getList(){
	  uni.showLoading({
	  	title: '加载中'
	  })
	  this.$http('jeecg-boot/app/market/bicStoreAccount/list',{
	  	pageNo:1,
		pageSize:100,
	  },'GET').then(res => {
	  	 uni.hideLoading();
		 this.employeeList=res.result.records
		})
	},
    addEmployee() {
      uni.navigateTo({
      	url:'addAccount'
      })
    }
  }
}
</script>

<style>
.container {
  padding: 20rpx;
  min-height: 100vh;
}

/* 员工列表样式 */
.employee-list {
  margin-bottom: 40rpx;
}

.employee-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30rpx;
  margin-bottom: 20rpx;
  background-color: #fff;
  border-radius: 16rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
}

.item-left {
  display: flex;
  flex-direction: column;
}

.account {
  font-size: 32rpx;
  color: #333;
  margin-bottom: 10rpx;
}

.role {
  font-size: 26rpx;
  color: #666;
}

.time {
  font-size: 26rpx;
  color: #999;
}

/* 新增按钮样式 */
.add-btn {
  position: fixed;
  bottom: 40rpx;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 90rpx;
  background: linear-gradient(to right, #4a8bf5, #6a5af9);
  border-radius: 50rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 32rpx;
  box-shadow: 0 8rpx 20rpx rgba(74, 139, 245, 0.3);
}
</style>